MYTHREAD:=mythread

MYTHREAD_BASEDIR:=$(BASEDIR)/$(MYTHREAD)

MYTHREAD_CC:=g++
MYTHREAD_LD:=g++

MYTHREAD_MODULES_DEPENDENCIES:=

MYTHREAD_INCFLAGS:=-I$(MYTHREAD_BASEDIR)/inc -I$(BASEDIR)/common/inc $(patsubst %, -I$(BASEDIR)/%/inc, $(MYTHREAD_MODULES_DEPENDENCIES))

ifeq ($(SYSTEM), MINGW32_NT-5.1)
MYTHREAD_DEBUG_CFLAGS:=-g -Wall -W -pedantic -Woverloaded-virtual -D_REENTRANT -DDEBUG $(MYTHREAD_INCFLAGS)
MYTHREAD_DEBUG_LDFLAG:=
MYTHREAD_DEBUG_LIBS:=

MYTHREAD_RELEASE_CFLAGS:=-Wall -W -pedantic -Woverloaded-virtual -D_REENTRANT -DRELEASE $(MYTHREAD_INCFLAGS)
MYTHREAD_RELEASE_LDFLAG:=
MYTHREAD_RELEASE_LIBS:=
endif

ifeq ($(SYSTEM), Linux)
MYTHREAD_DEBUG_CFLAGS:=-g -Wall -fPIC -W -pedantic -Woverloaded-virtual -D_REENTRANT -DDEBUG $(MYTHREAD_INCFLAGS)
MYTHREAD_DEBUG_LDFLAG:=
MYTHREAD_DEBUG_LIBS:=

MYTHREAD_RELEASE_CFLAGS:=-Wall -W -fPIC -pedantic -Woverloaded-virtual -D_REENTRANT -DRELEASE $(MYTHREAD_INCFLAGS)
MYTHREAD_RELEASE_LDFLAG:=
MYTHREAD_RELEASE_LIBS:=
endif

MYTHREAD_SRC:=$(shell ls 2>&1 $(MYTHREAD_BASEDIR)/src/*.cpp)

TMP_MYTHREAD_OBJ:= $(patsubst %.cpp,%.o,$(filter %.cpp,$(MYTHREAD_SRC)))
TMP_MYTHREAD_DEP:= $(patsubst %.cpp,%.d,$(filter %.cpp,$(MYTHREAD_SRC)))

SRC+=$(MYTHREAD_SRC)

MYTHREAD_DEBUG_OBJS=$(shell echo $(TMP_MYTHREAD_OBJ) | sed -e 's@src@obj/debug@g' )
MYTHREAD_RELEASE_OBJS+=$(shell echo $(TMP_MYTHREAD_OBJ) | sed -e 's@src@obj/release@g' )

DEBUG_OBJS+=$(MYTHREAD_DEBUG_OBJS)
RELEASE_OBJS+=$(MYTHREAD_RELEASE_OBJS)

# Dependencies are release independant.
DEPS+=$(shell echo $(TMP_MYTHREAD_DEP) | sed -e 's@src@dep@g' )

DEBUG_MYTHREAD_ARCHIVE:=$(BASEDIR)/lib/debug/$(MYTHREAD).a
RELEASE_MYTHREAD_ARCHIVE:=$(BASEDIR)/lib/release/$(MYTHREAD).a

DEBUG_MYTHREAD_LIB:=$(BASEDIR)/lib/debug/lib$(MYTHREAD).so
RELEASE_MYTHREAD_LIB:=$(BASEDIR)/lib/release/lib$(MYTHREAD).so

DEBUG_ARCHIVES+=$(DEBUG_MYTHREAD_ARCHIVE)
RELEASE_ARCHIVES+=$(RELEASE_MYTHREAD_ARCHIVE)

DEBUG_LIBS+=$(DEBUG_MYTHREAD_LIB)
RELEASE_LIBS+=$(RELEASE_MYTHREAD_LIB)
